<?php
	require('model/WiktionnaryParser.class.php');
	require('model/WikipediaParser.class.php');
	require('model/WikinewsParser.class.php');
	
	class Model{
	
		var $WIKIPEDIA_PARSER = 0;
		var $WIKTIONNARY_PARSER = 1;
		var $WIKINEWS_PARSER = 2;
		
		var $parser;
		var $error = false;
		
		function Model(){}
		
		function init($parser_type, $url, $internalParser = null){;
			switch($parser_type){
				case $this->WIKIPEDIA_PARSER:
					$this->parser = new WikipediaParser($url);
					break;
				case $this->WIKTIONNARY_PARSER:
					$this->parser = new WiktionnaryParser($url);
					break;
				case $this->WIKINEWS_PARSER:
					$this->parser = new WikinewsParser($url, $internalParser);
					break;	
				default :
					$this->error = true;
			}
		}
		
		function check_error(){
			return $this->error || $this->parser->check_error();
		}
		
		function get_parser(){
			return $this->parser;
		}
		
	}

?>